#!/usr/bin/env python

#Copyright (C) 2008 Luis Felipe Millani (lf.millani@gmail.com)

#This file is part of MagicLyrics.

#MagicLyrics is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.

#MagicLyrics is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.

#You should have received a copy of the GNU General Public License
#along with MagicLyrics.  If not, see <http://www.gnu.org/licenses/>.
version='1.0'
description='MagicLyrics automatically finds and displays the lyrics for the currently playing song'

zipName='magicLyrics'
zipExt='.zip'
zipCmd='7z'
zipPara='a '+zipName+zipExt+' '+zipName # this is extremely slow and certainly unnecessary

datafiles=['../COPYING','../LICENSE']





# remove old files
import os
import shutil
for dir in ('build','dist',zipName):
	if os.path.isdir(dir):
		shutil.rmtree(dir)
if os.path.isfile(zipName+zipExt):os.remove(zipName+zipExt)


# get includes
from sys import argv
import glob
includes=['wxPython.wx']+glob.glob('*.py')
includes.remove(os.path.basename(argv[0])) # do not include this file
includes=map(lambda x:x[:-3],includes)


# create exe
from distutils.core import setup
import py2exe
if len(argv)==1:argv.append('py2exe')

setup(
	windows=[{
		'script':'main.py',
		'icon_resources':[(0,'main.ico')]}],
	options={'py2exe':
		{'optimize':2,
		#'compressed':1,
		'includes':includes}}
)


# create zip
os.rename('dist',zipName)
os.system(zipCmd+' '+zipPara)


# remove unnecessary files
shutil.rmtree('build')
shutil.rmtree(zipName)